<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
    <script src="../../vue/vue.js"></script>
</head>
<body>
    <!-- v-for是Vue.js的循环语句，当需要遍历数组或对象时，常用的就是列表渲染指令v-for，它需要
    结合着in或者of使用 -->
    <div id="app">
        <ul>
            <li v-for="item in arr">{{item}}</li>
        </ul>

        <ul>
            <li v-for="(item,index) in arr">{{index+1}}--{{item}}</li>
        </ul>

        <table border="1" v-for="(item,index) in arr">
            <tr>
                <th>序号</th><th>名称</th>
                
            </tr>
            <tr>
                    <td>{{index}}</td><td>{{item}}</td>
                </tr>
        </table>

        <ul>
            <li v-for="item in obj">{{item}}</li>
            <li v-for="(item,key) in obj">{{key}}--{{item}}</li> 
            <li v-for="(item,key,index) in obj">{{index}}--{{key}}--{{item}}</li>
        </ul>

        <p v-for="c in msg">{{c}}</p>

        <ul>
            <li v-for="num in 10">这是第{{num}}次循环</li>
        </ul>
    </div>
    
</body>
<script>
    new Vue({
        el:"#app",
        data(){
            return{
                arr:["苹果","桃子","乌龙茶"],
                obj:{
                    name:"Jack",
                    class:"3-2",
                    sex:"male",

                },
                msg:"Hello World!"
            }
            
        }
    })
</script>
</html>